package com.leif.learning.controller;

import com.leif.learning.domain.vo.SignResultVO;
import com.leif.learning.service.ISignRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 签到相关接口
 *
 * @author fei.lin
 * @version 1.0.0
 * @date 2025/10/26
 */
@RestController
@RequestMapping("sign-records")
@Tag(name = "签到相关接口")
@RequiredArgsConstructor
public class SignRecordController {

    private final ISignRecordService recordService;

    /**
     * 签到功能接口
     * 以每月签到为一个周期，上个月通过定时同步到数据库中保存，当前月签到数据保存在redis中
     *
     * @return
     */
    @Operation(summary = "签到功能接口")
    @PostMapping
    public SignResultVO addSignRecords() {
        return recordService.addSignRecords();
    }

    @Operation(summary = "查询签到记录")
    @GetMapping
    public Byte[] querySignRecords() {
        return recordService.querySignRecords();
    }

}
